<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>插件列表</title>
		<link rel="stylesheet" type="text/css" href="../css/public.css" />
		<link rel="stylesheet" href="../bootstrap/dist/css/bootstrap.min.css">
		<link rel="stylesheet" href="../css/font-awesome.min.css">
		<link rel="stylesheet" href="../css/ionicons.min.css">
		<link rel="stylesheet" href="../css/AdminLTE.min.css">
		<link rel="stylesheet" href="../dist/css/skins/_all-skins.min.css">
		<link rel="stylesheet" type="text/css" href="../css/fileinput.min.css" />
		<link rel="stylesheet" type="text/css" href="../css/bootstrap-datetimepicker.min.css" />
		<link rel="stylesheet" type="text/css" href="../css/public_main.css" />
		<style type="text/css">
			body #select_wuye,
			#select_village,
			#select_build,
			#select_unit {
				display: inline-block;
				/*margin-top: 5px;*/
				width: 124px;
				height: 34px;
				margin-left: 10px;
			}
			
			#ppp label {
				margin-left: 10px;
				font-size: 12px;
			}
			
			.remove span {
				cursor: pointer;
			}
			
			.table_cla {
				/*height: 560px;*/
			}
			
			td img {
				height: 18px;
				width: auto;
			}
			
			#ppp #myTabContent #zhuce .two_img {
				width: 75px;
				height: 75px;
			}
			
			#ppp #myTabContent #zhuce .three_img {
				width: 113px;
				height: 113px;
			}
			
			video {
				width: 100%;
				height: auto;
			}
		</style>

	</head>

	<body>
		<div class="box" id="app">
			<div class="box-header with-border">
				<h3 class="box-title">插件列表</h3>
			</div>
			<div id="mohu" class="my_feilei">
				<!--<label for="name">物业</label>
				<select id="select_wuye" @change="property_change" v-model="organizeid" style="display: inline-block;" class="form-control">
					<option v-for="item in property_name" :value="item.organizeid" v-text="item.shortname"></option>
				</select>
				<label for="name">小区</label>
				<select id="select_village" v-model="areaid" style="display: inline-block;" class="form-control">
					<option v-for="item in village_name" :value="item.areaid" v-text="item.areaname"></option>
				</select>-->
				<input type="text" name="" id="text_sousuo" v-model="selectinfo" placeholder="请输入需要查询的内容" />
				<button id="search_chaxun" @click="search" type="button" class="btn btn-success">搜索</button>
				<button data-toggle="modal" data-target="#mac_add" @click="add_mac" type="button" class="btn btn-info">添加插件</button>
				<button data-toggle="modal" data-target="#mac_two_menu" @click="add_two_menu" type="button" class="btn btn-info">添加二级菜单</button>
				<button data-toggle="modal" data-target="#details_add" @click="add_datails_page" type="button" class="btn btn-info">添加详情页面</button>
			</div>
			<div style="margin-top: 0px;" class="table_cla">
				<table class="table table-bordered">
					<tr>
						<th>序号</th>
						<th>插件名称</th>
						<th>插件价格</th>
						<th>状态</th>
						<th>app </th>
						<th>创建时间</th>
						<th>图片地址 </th>
						<th>操作</th>
					</tr>
					<tbody id="tbbb">
						<tr v-for="(item,index) in tabel_data">
							<td v-text="index+1"></td>
							<td v-text="item.goodsname"></td>
							<td v-text="item.goodsprice"></td>
							<td v-text="item.status"></td>
							<td v-text="item.isexistapp"></td>
							<td v-text="item.createDateStr"></td>
							<td>
								<img data-action="zoom" :src="item.imgpath" />
							</td>
							<td class="remove">
								<span style="color: #286090;" data-toggle="modal" data-target="#myModal" @click="sure_more(item)" class="glyphicon glyphicon-align-justify">详情&nbsp;</span>
								<!--<span style="color: #f0ad4e;" data-toggle="modal" data-target="#mac_fix" @click="fix_more(item)" class="	glyphicon glyphicon-pencil">修改&nbsp;</span>-->
								<!--<span style="color: #d43f3a;" data-toggle="modal" data-target="#remove_mac" @click="remove_more(item)" class="glyphicon glyphicon-trash">删除&nbsp;</span>-->
							</td>
						</tr>
					</tbody>
				</table>
			</div>

			<!-- /.box-body -->
			<ul class="pagination" style="margin-left: 10px;">
				<span style="margin-left: 10px;" v-text="count_all"></span>
				<!--<li v-show="current != 1" @click="current-- && goto(current--)">
					<a href="#">上一页</a>
				</li>-->
				<li v-for="index in pages" @click="goto(index)" :class="{'active':current == index}" :key="index">
					<a href="#" v-text="index"></a>
				</li>
				<!--<li v-show="allpage != current && allpage != 0 " @click="current++ && goto(current++)">
					<a href="#">下一页</a>
				</li>-->
				<span style="margin-left: 10px;">跳到:</span>
				<!--<input style="width: 50px;height: 34px;" min="1" max="{{allpage}}" type="number" name="goto" id="goto" v-model="jump" />-->
				<input style="width: 50px;height: 28px;" name="goto" id="goto" v-model="jump" type="text" name="" oninput="value=value.replace(/[^\d]/g,'')">
				<span>页</span>
				<button type="button" id="gotoo" @click="goto(jump)" class="btn btn-danger ">确定 </button>
			</ul>
			<!-- 增加插件模态框（Modal） -->
			<div class="modal fade" id="mac_add" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel">添加插件</h4>
						</div>
						<div class="modal-body" id="shenhe">
							<ul id="ppp">
								<li>
									<span>插件名称：</span><input type="text" v-model="add_data.goodsname" placeholder="请输入插件名称" />
								</li>
								<li>
									<span>插件价格：</span><input oninput="value=value.replace(/[^\d]/g,'')" type="text" v-model="add_data.goodsprice" placeholder="请输入插件价格" />
								</li>
								<li>
									<span>状态：</span>
									<select v-model="add_data.status" name="">
										<option value="1">敬请期待</option>
										<option value="2">可购买安装</option>
									</select>
								</li>
								<li>
									<span>商品描述：</span><textarea placeholder="请输入商品描述" v-model="add_data.description" name="" rows="" cols=""></textarea>
								</li>

								<!--<li>-->
								<h4 style="margin-left: 10px;">插件图片</h4>

								<form style="" id="Form1" method="post" enctype="multipart/form-data" onsubmit="return saveReport();" target="hidden_frame">
									<input id="uploadfile" name="pic" type="file" class="file">
								</form>
								<h4>插件视频</h4>
								<form style="" id="Form2" method="post" enctype="multipart/form-data" onsubmit="return saveReport();" target="hidden_frame">
									<input id="uploadfile2" name="files" type="file" class="file">
								</form>

								<li>
									<span>app：</span>
									<select v-model="add_data.isexistapp" name="">
										<option value="">选择是否存在app</option>
										<option value="0">不存在</option>
										<option value="1">存在</option>
									</select>
								</li>
								<div v-show="add_data.isexistapp==1">
									<li>
										<span>app名字：</span><input placeholder="请输入app名字" type="text" v-model="add_data.appname" />
									</li>
									<li>
										<span>app地址：</span><input placeholder="请输入app地址" type="text" v-model="add_data.appurl" />
									</li>
									<h4>app2倍图</h4>
									<form style="" id="Form3" method="post" enctype="multipart/form-data" onsubmit="return saveReport();" target="hidden_frame">
										<input id="uploadfile3" name="pic" type="file" class="file">
									</form>
									<h4>app3倍图</h4>
									<form style="" id="Form4" method="post" enctype="multipart/form-data" onsubmit="return saveReport();" target="hidden_frame">
										<input id="uploadfile4" name="pic" type="file" class="file">
									</form>
									<li>
										<span>详情页：</span>
										<select v-model="add_data.isexistdetails" name="">
											<option value="">选择是否存在详情页</option>
											<option value="0">不存在</option>
											<option value="1">存在</option>
										</select>
									</li>
									<div v-if="add_data.isexistdetails == 1">
										<div v-for="(item,index) in detailsurl">
											<li>
												<span v-text="'详情'+(index+1)+'名字：'"></span><input placeholder="请输入详情页名称" type="text" v-model="detailsurl[index].name" />
											</li>
											<li>
												<span v-text="'详情'+(index+1)+'地址：'"></span><input placeholder="请输入详情页地址" type="text" v-model="detailsurl[index].url" />
											</li>
											<li>
												<span v-text="'type'+(index+1)+':'"></span><input oninput="value=value.replace(/[^\d]/g,'')" placeholder="请输入type,type为数字" type="text" v-model="detailsurl[index].orderinfotype" />
											</li>
										</div>
										<button type="button" @click="add_details" class="btn btn-primary">增加一个详情页</button>
									</div>
								</div>

							</ul>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
							<button type="button" id="sure_mac_add" @click="sure_mac_add" class="btn btn-primary">确定增加</button>
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
				<!-- /.modal -->
			</div>
			<!-- 增加二级菜单模态框（Modal） -->
			<div class="modal fade" id="mac_two_menu" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel">添加二级菜单</h4>
						</div>
						<div class="modal-body" id="shenhe">
							<ul id="ppp">
								<li>
									<span>选择插件</span>
									<select name="" v-model="two_menu_data.parentid">
										<option v-for="item in getParentModule" :value="item.moduleid" v-text="item.fullname"></option>
									</select>
								</li>
								<li>
									<span>二级菜单名称：</span><input type="text" v-model="two_menu_data.fullname" placeholder="请输入二级菜单名称" />
								</li>
								<li>
									<span>二级菜单地址：</span><input type="text" v-model="two_menu_data.urladdress" placeholder="请输入二级菜单地址" />
								</li>
								<li>
									<span>选择参数：</span>
									<input style="width: auto;height: auto;margin-left: 10px;" type="checkbox" id="jack" value="userid" v-model="two_menu_data.target">
									<label style="margin-left: 3px;" for="userid">用户ID</label>
									<input style="width: auto;height: auto;margin-left: 10px;" type="checkbox" id="john" value="realname" v-model="two_menu_data.target">
									<label style="margin-left: 3px;" for="realname">用户姓名</label>
									<input style="width: auto;height: auto;margin-left: 10px;" type="checkbox" id="mike" value="merchantid" v-model="two_menu_data.target">
									<label style="margin-left: 3px;" for="merchantid">物业公司id</label>
									<input style="width: auto;height: auto;margin-left: 10px;" type="checkbox" id="mike" value="areaid" v-model="two_menu_data.target">
									<label style="margin-left: 3px;" for="areaid">小区id</label>
								</li>
								<li>
									<span>参数名:</span>
									<label v-text="two_menu_data.target "></label>
								</li>
							</ul>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
							<button type="button" id="sure_twomenu_add" @click="sure_twomenu_add" class="btn btn-primary">确定增加</button>
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
				<!-- /.modal -->
			</div>
			<!--插件详情模态框-->
			<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel">插件详情</h4>
						</div>
						<div id="shenhe" class="modal-body">
							<ul id="myTab" class="nav nav-tabs">
								<li class="active">
									<a href="#home" data-toggle="tab">
										插件信息
									</a>
								</li>
								<li>
									<a href="#fix" data-toggle="tab">
										二级菜单
									</a>
								</li>
								<li v-if="more_data.isexistapp==1">
									<a href="#zhuce" data-toggle="tab">
										app信息
									</a>
								</li>
								<li>
									<a href="#zizhi" data-toggle="tab">
										插件视频
									</a>
								</li>
							</ul>
							<ul id="ppp">
								<div id="myTabContent" class="tab-content">
									<div class="tab-pane fade in active" id="home">
										<li>
											<span>插件名称：</span><label type="text" v-text="more_data.goodsname"></label>
										</li>
										<li>
											<span>插件图片：</span><img data-action="zoom" :src="more_data.imgpath" alt="" />
										</li>
										<li>
											<span>商品描述：</span><textarea v-model="more_data.description" name="" rows="" cols=""></textarea>
										</li>
									</div>
									<div class="tab-pane fade" id="fix">
										<h4 v-if="more_data.basemodules!=''" style="margin-left: 10px;">二级菜单集合</h4>
										<li v-for="item in more_data.basemodules">
											<span v-text="item.fullname"></span><label type="text" v-text="item.urladdress"></label>
										</li>
										<h4 style="margin-left: 10px;">添加二级菜单需传参数</h4>
										<li>
											<span>参数:</span><label type="text" v-text="more_data.storerole"></label>
										</li>
									</div>
									<div v-if="more_data.isexistapp==1" class="tab-pane fade" id="zhuce">
										<li>
											<span>app名字：</span><label type="text" v-text="more_data.appname"></label>
										</li>
										<li>
											<span>app链接：</span><label type="text" v-text="more_data.appurl"></label>
										</li>
										<li>
											<span>2倍图标：</span><img class="two_img" data-action="zoom" :src="more_data.appicon" alt="" />
										</li>
										<li>
											<span>3倍图标：</span><img class="three_img" data-action="zoom" :src="more_data.appicon3" alt="" />
										</li>

										<h4 v-if="more_data.baseStoreOrderUrls!=''" style="margin-left: 10px;">详情页</h4>
										<div v-for="item in more_data.baseStoreOrderUrls">
											<li>
												<span v-text="item.name+':'"></span><label type="text" v-text="item.url"></label>
											</li>
											<li>
												<span v-text="item.name+'type:'"></span><label type="text" v-text="item.orderinfotype"></label>
											</li>
										</div>

									</div>
									<div class="tab-pane fade" id="zizhi">
										<li>
											<span>插件视频：</span>
											<video controls="controls" :src="more_data.videopath"></video>
										</li>
									</div>
								</div>
							</ul>

						</div>
						<div class="modal-footer">
							<div class="wuxushenhe">
								<button type="button" class="btn btn-default fanhui" data-dismiss="modal">返回</button>
							</div>
						</div>
					</div>
				</div>
			</div>
			<!-- 模态框（Modal）提示信息 -->
			<div class="modal fade" id="myModal_tips" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel">提示信息</h4>
						</div>
						<div class="modal-body" id="tips" v-text="tips_modal">

						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
						</div>
					</div>
				</div>
			</div>
			<!-- 增加详情页模态框（Modal） -->
			<div style="z-index: 1049;" class="modal fade" id="details_add" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
							<h4 class="modal-title" id="myModalLabel">添加详情页</h4>
						</div>
						<div class="modal-body" id="shenhe">
							<ul id="ppp">
								<li>
									<span>选择插件</span>
									<select name="" v-model="details_data.goodsid">
										<option v-for="item in selectbasestore" :value="item.goodsid" v-text="item.goodsname"></option>
									</select>
								</li>
								<li>
									<span>详情页名称：</span><input type="text" v-model="details_data.detailsurl[0].name" placeholder="请输入详情页名称" />
								</li>
								<li>
									<span>详情页地址：</span><input type="text" v-model="details_data.detailsurl[0].url" placeholder="请输入详情页地址" />
								</li>
								<li>
									<span>详情页type：</span><input type="text" v-model="details_data.detailsurl[0].orderinfotype" oninput="value=value.replace(/[^\d]/g,'')" placeholder="请输入type,type为数字" />
								</li>
							</ul>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
							<button type="button" id="add_app_detailurls" @click="add_app_detailurls" class="btn btn-primary">确定增加</button>
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
				<!-- /.modal -->
			</div>

		</div>

	</body>

</html>
<script src="../js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../bootstrap/dist/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/public.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/qunit-1.11.0.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/bootstrap-paginator.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/vue.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/zooming.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/fileinput.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/zh.js" type="text/javascript" charset="utf-8"></script>
<script>
	//	var urlr = "http://192.168.0.30:8085"
	new Vue({
		el: '#app',
		data: {
			urltest: "",
			yanli_url: '',
			tips_modal: "",
			selectinfo: "",
			tabel_data: "",
			current: 1,
			showItem: 5,
			rechresult: "",
			allpage: "",
			jump: "",
			userId: "",
			userName: "",
			fullname: "",
			selectbasestore: [{
				goodsname: "请选择插件名字",
				goodsid: '',
			}],
			details_data: {
				goodsid: "",
				detailsurl: [{
					name: "",
					url: "",
					orderinfotype: "",
				}]
			},
			vendor: "",
			count_all: "",
			more_data: "",
			videopath: "",
			imgpath: "",
			appicon: "",
			appicon3: "",
			getParentModule: [{
				fullname: "请选择插件名字",
				moduleid: '',
			}],
			two_menu_data: {
				parentid: "",
				fullname: "",
				urladdress: "",
				target: [],
				storerole: "",
			},
			add_data: {
				isexistapp: "",
				isexistdetails: '',
				status: 2,
				goodsname: "",
				goodsprice: "",
				description: "",
				appurl: "",
				appname: "",
				isexistdetails: "",
			},
			fix_data: {
				macadder: "",
				boardname: "",
				manufacturername: "",
				remarks: "",
			},
			model_data: "",
			dat_remove: "",

			detailsurl: [{
				name: "",
				url: "",
				orderinfotype: ""
			}]
		},
		//计算属性
		computed: {

		},
		created: function() {

		},
		mounted: function() {
			var userId = sessionStorage.getItem("userId");
			if(userId == "" || userId == undefined || userId == null) {
				top.location.href = "../login.html";
			} else {
				var that = this;
				that.yanli_url = getUrl_yangli();
				that.urltest = sessionStorage.getItem("urltest");
				that.userId = sessionStorage.getItem("userId");
				that.fullname = sessionStorage.getItem("fullname");
				that.userName = sessionStorage.getItem("userName");
				that.two_menu_data.parentid = that.getParentModule[0].moduleid;
				that.details_data.goodsid = that.selectbasestore[0].goodsid;
				var datainit = JSON.stringify({
					requestString: JSON.stringify({
						selectinfo: that.selectinfo,
						pageNumber: 1,
						pageSize: 10
					}),
					userId: that.userId,
					fullname: that.fullname
				});
				that.tabel_loading(datainit);
				that.upload_img();
				that.upload_video();
				that.upload_img2();
				that.upload_img3();
			}
		},
		computed: {
			pages: function() {
				var pag = [];
				if(this.current < this.showItem) { //如果当前的激活的项 小于要显示的条数
					//总页数和要显示的条数那个大就显示多少条
					var i = Math.min(this.showItem, this.allpage);
					while(i) {
						pag.unshift(i--);
					}
				} else { //当前页数大于显示页数了
					var middle = this.current - Math.floor(this.showItem / 2), //从哪里开始
						i = this.showItem;
					if(middle > (this.allpage - this.showItem)) {
						middle = (this.allpage - this.showItem) + 1
					}
					while(i--) {
						pag.push(middle++);
					}
				}
				return pag
			},
		},
		methods: {
			//加载表格
			tabel_loading: function(data) {
				var that = this;
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.yanli_url + 'baseStore/selectBaseStoreList',
					data: data,
					async: true,
					dataType: "json",
					success: function(msg) {

						if(msg.responseCode == 200) {
							that.tabel_data = JSON.parse(msg.returnString);
							var data = that.tabel_data;						
							
							var yu = msg.count % 10;
							that.count_all = "共" + msg.count + "条"
							if(yu == 0) {
								that.allpage = parseInt(msg.count / 10);
							} else {
								that.allpage = parseInt(msg.count / 10) + 1;
							}

							for(var i = 0; i < data.length; i++) {
								if(data[i].status == 1) {
									data[i].status = "敬请期待"
								} else if(data[i].status == 2) {
									data[i].status = "可购买安装"
								}
								if(data[i].isexistapp == 1) {
									data[i].isexistapp = "存在"
								} else if(data[i].isexistapp == 0) {
									data[i].isexistapp = "不存在"
								}
							}
						} else {
							that.tips_modal = msg.resoponseDisp;
							$('#myModal_tips').modal('show');
						}
					},
					error: function() {
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});
			},
			//			分页跳转
			goto: function(index) {
				var that = this;
				if(index == that.current) return;
				if(index > that.allpage) {
					return
				}
				var re = /^[1-9]+[0-9]*]*$/ //判断正整数      // /^[0-9]+.?[0-9]*$/; //判断字符串是否为数字  
				if(!re.test(index)) {
					return false;
				}
				this.current = index;
				var datainit = JSON.stringify({
					requestString: JSON.stringify({
						pageNumber: index,
						pageSize: 10,
						selectinfo: that.selectinfo,
					}),
					userId: that.userId,
					fullname: that.fullname
				});
				that.tabel_loading(datainit);
				//这里可以发送ajax请求
			},
			//搜索
			search: function() {
				var that = this;
				var datainit = JSON.stringify({
					requestString: JSON.stringify({
						pageNumber: 1,
						pageSize: 10,
						selectinfo: that.selectinfo,
					}),
					userId: that.userId,
					fullname: that.fullname
				});
				that.tabel_loading(datainit);

			},
			//查看详情
			sure_more: function(data) {
				var that = this;
				var datainit = JSON.stringify({
					requestString: JSON.stringify({
						goodsid: data.goodsid,
					}),
					userId: that.userId,
					fullname: that.fullname
				});
				//查看详情请求接口
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.yanli_url + 'baseStore/selectBaseStoreById',
					data: datainit,
					async: true,
					dataType: "json",
					success: function(msg) {
						if(msg.responseCode == 200) {
							that.more_data = JSON.parse(msg.returnString);
							console.log(that.more_data)
						} else {
							that.tips_modal = msg.resoponseDisp;
							$('#myModal_tips').modal('show');
						}
					},
					error: function() {
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});

			},

			//上传图片
			upload_img: function() {
				var that = this;
				$("#uploadfile").fileinput({
					language: 'zh', //设置语言
					uploadUrl: that.urltest + "woke/public/addServiceProviderQualifications", //"http://www.wkdzkj.cn/woke-oss-web/woke/public/addServiceProviderQualifications", //上传的地址
					allowedFileExtensions: ['jpg', 'png', 'gif'], //接收的文件后缀
					//uploadExtraData:{"id": 1, "fileName":'123.mp3'},
					uploadAsync: true, //默认异步上传
					showUpload: true, //是否显示上传按钮
					showRemove: true, //显示移除按钮
					showPreview: true, //是否显示预览
					showCaption: false, //是否显示标题
					browseClass: "btn btn-primary", //按钮样式    
					dropZoneEnabled: true, //是否显示拖拽区域
					//minImageWidth: 50, //图片的最小宽度
					//minImageHeight: 50,//图片的最小高度
					//maxImageWidth: 1000,//图片的最大宽度
					maxImageHeight: 5120, //图片的最大高度
					//maxFileSize:0,//单位为kb，如果为0表示不限制文件大小
					//minFileCount: 0,
					maxFileCount: 1, //表示允许同时上传的最大文件个数
					enctype: 'multipart/form-data',
					validateInitialCount: true,
					previewFileIcon: "<iclass='glyphicon glyphicon-king'></i>",
					msgFilesTooMany: "选择上传的文件数量({n}) 超过允许的最大数值{m}！",
				}).on("fileuploaded", function(event, data, previewId, index) {
					var url1 = data.response.returnString;
					var bb = JSON.parse(url1);
					that.imgpath = bb[0].url;
					console.log(that.imgpath);
				});
			},
			//上传视频			
			upload_video: function() {
				var that = this;
				$("#uploadfile2").fileinput({
					language: 'zh', //设置语言
					uploadUrl: that.urltest + "woke/public/addFile", //"http://www.wkdzkj.cn/woke-oss-web/woke/public/addServiceProviderQualifications", //上传的地址
					allowedFileExtensions: ['mp4', 'ogv', 'webm', 'swf'], //接收的文件后缀
					//uploadExtraData:{"id": 1, "fileName":'123.mp3'},
					uploadAsync: true, //默认异步上传
					showUpload: true, //是否显示上传按钮
					showRemove: true, //显示移除按钮
					showPreview: true, //是否显示预览
					showCaption: false, //是否显示标题
					browseClass: "btn btn-primary", //按钮样式    
					dropZoneEnabled: true, //是否显示拖拽区域
					//minImageWidth: 50, //图片的最小宽度
					//minImageHeight: 50,//图片的最小高度
					//maxImageWidth: 1000,//图片的最大宽度
					maxImageHeight: 5120, //图片的最大高度
					//maxFileSize:0,//单位为kb，如果为0表示不限制文件大小
					//minFileCount: 0,
					maxFileCount: 1, //表示允许同时上传的最大文件个数
					enctype: 'multipart/form-data',
					validateInitialCount: true,
					previewFileIcon: "<iclass='glyphicon glyphicon-king'></i>",
					msgFilesTooMany: "选择上传的文件数量({n}) 超过允许的最大数值{m}！",
				}).on("fileuploaded", function(event, data, previewId, index) {
					var url2 = data.response.returnString;
					var bb = JSON.parse(url2);
					that.videopath = bb[0].url;
					console.log(that.videopath);
				});
			},
			//上传2倍图
			upload_img2: function() {
				var that = this;
				$("#uploadfile3").fileinput({
					language: 'zh', //设置语言
					uploadUrl: that.urltest + "woke/public/addServiceProviderQualifications", //"http://www.wkdzkj.cn/woke-oss-web/woke/public/addServiceProviderQualifications", //上传的地址
					allowedFileExtensions: ['jpg', 'png', 'gif'], //接收的文件后缀
					//uploadExtraData:{"id": 1, "fileName":'123.mp3'},
					uploadAsync: true, //默认异步上传
					showUpload: true, //是否显示上传按钮
					showRemove: true, //显示移除按钮
					showPreview: true, //是否显示预览
					showCaption: false, //是否显示标题
					browseClass: "btn btn-primary", //按钮样式    
					dropZoneEnabled: true, //是否显示拖拽区域
					//minImageWidth: 50, //图片的最小宽度
					//minImageHeight: 50,//图片的最小高度
					//maxImageWidth: 1000,//图片的最大宽度
					maxImageHeight: 5120, //图片的最大高度
					//maxFileSize:0,//单位为kb，如果为0表示不限制文件大小
					//minFileCount: 0,
					maxFileCount: 1, //表示允许同时上传的最大文件个数
					enctype: 'multipart/form-data',
					validateInitialCount: true,
					previewFileIcon: "<iclass='glyphicon glyphicon-king'></i>",
					msgFilesTooMany: "选择上传的文件数量({n}) 超过允许的最大数值{m}！",
				}).on("fileuploaded", function(event, data, previewId, index) {
					//	debugger
					//	console.log(data.response);
					var url1 = data.response.returnString;
					var bb = JSON.parse(url1);
					that.appicon = bb[0].url;
					console.log(that.appicon);
				});
			},
			//上传3倍图
			upload_img3: function() {
				//				debugger
				var that = this;
				$("#uploadfile4").fileinput({
					language: 'zh', //设置语言
					uploadUrl: that.urltest + "woke/public/addServiceProviderQualifications", //"http://www.wkdzkj.cn/woke-oss-web/woke/public/addServiceProviderQualifications", //上传的地址
					allowedFileExtensions: ['jpg', 'png', 'gif'], //接收的文件后缀
					//uploadExtraData:{"id": 1, "fileName":'123.mp3'},
					uploadAsync: true, //默认异步上传
					showUpload: true, //是否显示上传按钮
					showRemove: true, //显示移除按钮
					showPreview: true, //是否显示预览
					showCaption: false, //是否显示标题
					browseClass: "btn btn-primary", //按钮样式    
					dropZoneEnabled: true, //是否显示拖拽区域
					//minImageWidth: 50, //图片的最小宽度
					//minImageHeight: 50,//图片的最小高度
					//maxImageWidth: 1000,//图片的最大宽度
					maxImageHeight: 5120, //图片的最大高度
					//maxFileSize:0,//单位为kb，如果为0表示不限制文件大小
					//minFileCount: 0,
					maxFileCount: 1, //表示允许同时上传的最大文件个数
					enctype: 'multipart/form-data',
					validateInitialCount: true,
					previewFileIcon: "<iclass='glyphicon glyphicon-king'></i>",
					msgFilesTooMany: "选择上传的文件数量({n}) 超过允许的最大数值{m}！",
				}).on("fileuploaded", function(event, data, previewId, index) {
					var url1 = data.response.returnString;
					var bb = JSON.parse(url1);
					that.appicon3 = bb[0].url;
					console.log(that.appicon3);
				});
			},
			//增加一个详情页
			add_details: function() {
				var that = this;
				var data_arr = {
					name: "",
					url: "",
					orderinfotype: ""
				}
				that.detailsurl.push(data_arr);
			}, //			增加
			add_mac: function() {
				var that = this;
			},
			sure_mac_add: function() {
				var that = this;

				if(that.add_data.goodsname == '') {
					that.tips_modal = "商品名称未填写";
					$('#myModal_tips').modal('show');
					return
				}
				if(that.add_data.goodsprice == '') {
					that.tips_modal = "插件价格未设置";
					$('#myModal_tips').modal('show');
					return
				}
				if(that.add_data.description == '') {
					that.tips_modal = "插件描述未填写";
					$('#myModal_tips').modal('show');
					return
				}
				if(that.imgpath == '') {
					that.tips_modal = "插件图片未上传";
					$('#myModal_tips').modal('show');
					return
				}
				if(that.videopath == '') {
					that.tips_modal = "插件视频未上传";
					$('#myModal_tips').modal('show');
					return
				}
				if(that.add_data.isexistapp == '') {
					that.tips_modal = "请选择是否存在app";
					$('#myModal_tips').modal('show');
					return
				}
				if(that.add_data.isexistapp == 1) {
					if(that.add_data.appname == '') {
						that.tips_modal = "app名字未填写";
						$('#myModal_tips').modal('show');
						return
					}
					if(that.add_data.appurl == '') {
						that.tips_modal = "app2地址未填写";
						$('#myModal_tips').modal('show');
						return
					}
					if(that.appicon == '') {
						that.tips_modal = "app2倍图未上传";
						$('#myModal_tips').modal('show');
						return
					}
					if(that.appicon3 == '') {
						that.tips_modal = "app3倍图未上传";
						$('#myModal_tips').modal('show');
						return
					}
					if(that.add_data.isexistdetails == '') {
						that.tips_modal = "请选择是否存在详情页";
						$('#myModal_tips').modal('show');
						return
					}
					if(that.add_data.isexistdetails == 1) {
						if(that.add_data.detailsurl == '') {
							that.tips_modal = "详情页信息未填写完成";
							$('#myModal_tips').modal('show');
							return
						} else {
							for(var i = 0; i < that.detailsurl.length; i++) {
								if(that.detailsurl[i].name == '' || that.detailsurl[i].url == '' | that.detailsurl[i].orderinfotype == '') {
									that.tips_modal = "详情页信息未填写完成";
									$('#myModal_tips').modal('show');
									return
								}
							}
						}
					}
				}
				$('#sure_mac_add').attr('disabled', true);
				var datainit = JSON.stringify({
					requestString: JSON.stringify({
						goodsname: that.add_data.goodsname,
						status: that.add_data.status,
						imgpath: that.imgpath,
						videopath: that.videopath,
						goodsprice: that.add_data.goodsprice,
						description: that.add_data.description,
						isexistapp: that.add_data.isexistapp,
						appicon: that.appicon,
						appurl: that.add_data.appurl,
						appname: that.add_data.appname,
						appicon3: that.appicon3,
						isexistdetails: that.add_data.isexistdetails,
						detailsurl: that.detailsurl,
					}),
					userId: that.userId,
					fullname: that.fullname
				});
				console.log(datainit)
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.yanli_url + 'baseStore/addBaseStore',
					data: datainit,
					async: true,
					dataType: "json",
					success: function(msg) {
						if(msg.responseCode == 200) {
							that.tips_modal = "添加成功";
							$('#myModal_tips').modal('show');
							$('#myModal_tips').on('hide.bs.modal', function() { //								
								window.location.href = "property_plug-in.html";
							})
						} else {
							$('#sure_mac_add').attr('disabled', false);
							that.tips_modal = msg.resoponseDisp;
							$('#myModal_tips').modal('show');
						}
					},
					error: function() {
						$('#sure_mac_add').attr('disabled', false);
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});
			},
			//点击添加二级菜单
			add_two_menu: function() {
				var that = this;
				var datainit = JSON.stringify({
					requestString: JSON.stringify({}),
					userId: that.userId,
					fullname: that.fullname
				});
				that.get_parent_module(datainit);
			},
			//获取插件名字
			get_parent_module: function(data) {
				var that = this;
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.yanli_url + 'baseStore/selectStoreParentModule',
					data: data,
					async: true,
					dataType: "json",
					success: function(msg) {
						if(msg.responseCode == 200) {
							var aa = {
								fullname: "请选择插件名字",
								moduleid: '',
							}
							that.getParentModule = JSON.parse(msg.returnString);
							that.getParentModule.unshift(aa);
							that.two_menu_data.parentid = that.getParentModule[0].moduleid;
							console.log(that.getParentModule)
						} else {
							that.tips_modal = msg.resoponseDisp;
							$('#myModal_tips').modal('show');
						}
					},
					error: function() {
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});
			},
			sure_twomenu_add: function() {
				//				$("#sure_twomenu_add").prop("d")
				var that = this;
				$('#sure_twomenu_add').attr('disabled', true);
				that.two_menu_data.urladdress = "/#/iframe?onUrl=" + that.two_menu_data.urladdress;
				var num = createTimestamp() + createNonceStr();
				that.two_menu_data.storerole = num;
				console.log(that.two_menu_data);
				var datainit = JSON.stringify({
					requestString: JSON.stringify(
						that.two_menu_data
					),
					userId: that.userId,
					fullname: that.fullname
				});
				console.log(datainit)
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.yanli_url + 'baseStore/addBaseModule',
					data: datainit,
					async: true,
					dataType: "json",
					success: function(msg) {
						if(msg.responseCode == 200) {
							that.tips_modal = "添加成功";
							$('#myModal_tips').modal('show');
							$('#myModal_tips').on('hide.bs.modal', function() { //								
								window.location.href = "property_plug-in.html";
							})

						} else {
							$('#sure_twomenu_add').attr('disabled', false);
							that.tips_modal = msg.resoponseDisp;
							$('#myModal_tips').modal('show');
						}
					},
					error: function() {
						$('#sure_twomenu_add').attr('disabled', false);
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});
			},
			//点击添加详情页面
			add_datails_page: function() {
				var that = this;
				var datainit = JSON.stringify({
					requestString: JSON.stringify({}),
					userId: that.userId,
					fullname: that.fullname
				});
				that.select_base_store(datainit);
			},
			//获取插件名字
			select_base_store: function(data) {
				var that = this;
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.yanli_url + 'baseStore/selectBaseStore',
					data: data,
					async: true,
					dataType: "json",
					success: function(msg) {
						if(msg.responseCode == 200) {
							var aa = {
								goodsname: "请选择插件名字",
								goodsid: '',
							}
							that.selectbasestore = JSON.parse(msg.returnString);
							that.selectbasestore.unshift(aa);
							that.details_data.goodsid = that.selectbasestore[0].goodsid;
						} else {
							that.tips_modal = msg.resoponseDisp;
							$('#myModal_tips').modal('show');
						}
					},
					error: function() {
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});
			},
			add_app_detailurls: function() {
				var that = this;
				$('#add_app_detailurls').attr('disabled', true);
				var datainit = JSON.stringify({
					requestString: JSON.stringify(
						that.details_data
					),
					userId: that.userId,
					fullname: that.fullname
				});
				console.log(datainit)
				$.ajax({
					contentType: "application/json; charset=utf-8",
					type: "POST",
					url: that.yanli_url + 'baseStore/addAppDetailurls',
					data: datainit,
					async: true,
					dataType: "json",
					success: function(msg) {
						if(msg.responseCode == 200) {
							that.tips_modal = "添加成功";
							$('#myModal_tips').modal('show');
							$('#myModal_tips').on('hide.bs.modal', function() { //								
								window.location.href = "property_plug-in.html";
							});
						} else {
							$('#add_app_detailurls').attr('disabled', false);
							that.tips_modal = msg.resoponseDisp;
							$('#myModal_tips').modal('show');
						}
					},
					error: function() {
						$('#add_app_detailurls').attr('disabled', false);
						that.tips_modal = "获取信息失败";
						$('#myModal_tips').modal('show');
					}
				});
			}
			//			baseStore/addAppDetailurls
		},
	})
</script>
<script type="text/javascript">
	$(function() {
		$("#Form1 .file-drop-zone-title").html("上传插件图片");
		$("#Form2 .file-drop-zone-title").html("上传插件视频");
		$("#Form3 .file-drop-zone-title").html("上传app2倍图");
		$("#Form4 .file-drop-zone-title").html("上传app3倍图");

	})
</script>